<template lang="html">
  <div>
    <selfHeader></selfHeader>
    <div class="main">
      <isEmpty v-if='list.length === 0'></isEmpty>
      <div v-else class="listBox">
        <div v-for='(item, index) in list' :key='index'>
          <img v-if="item.image && item.image !== ''" :src='item.image'>
          <p>{{ item.content }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {noticeDetail} from '@/http/api'
import isEmpty from '@/components/isEmpty'
import selfHeader from '@/common/header'

export default {
  components: {
    isEmpty,
    selfHeader
  },
  data() {
    return {
      list: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList() {
      const user = JSON.parse(localStorage.getItem('UserMessage'))
      const data = {
        uid: user.user.uid
      }
      const res = await noticeDetail(data)
      if (res.code * 1 === 200) {
        this.list = res.data
      }
    }
  }
}
</script>
<style lang="less" scoped>
.main {
  width: 100%;
  padding-top: 50px;
}
.listBox {
  padding: 10px;
  box-sizing: border-box;
  div{
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #FFAA00;
  }
  img {
    width: 100%;
    height: 240px;
  }
  p {
    width: 100%;
    margin-top: 6px;
    line-height: 19px;
  }
}
</style>
